<?php

/**
 * Telefono filter form base class.
 *
 * @package    blackDrums
 * @subpackage filter
 * @author     Your name here
 */
abstract class BaseTelefonoFormFilter extends BaseFormFilterPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'codigoArea'        => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'numero'            => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'idClienteNatural'  => new sfWidgetFormPropelChoice(array('model' => 'ClienteNatural', 'add_empty' => true)),
      'idContactoEmpresa' => new sfWidgetFormPropelChoice(array('model' => 'ContactoEmpresa', 'add_empty' => true)),
    ));

    $this->setValidators(array(
      'codigoArea'        => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'numero'            => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'idClienteNatural'  => new sfValidatorPropelChoice(array('required' => false, 'model' => 'ClienteNatural', 'column' => 'cedula')),
      'idContactoEmpresa' => new sfValidatorPropelChoice(array('required' => false, 'model' => 'ContactoEmpresa', 'column' => 'cedula')),
    ));

    $this->widgetSchema->setNameFormat('telefono_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Telefono';
  }

  public function getFields()
  {
    return array(
      'idTelefono'        => 'Number',
      'codigoArea'        => 'Number',
      'numero'            => 'Number',
      'idClienteNatural'  => 'ForeignKey',
      'idContactoEmpresa' => 'ForeignKey',
    );
  }
}
